#ifndef MESSAGE_H
#define MESSAGE_H
#include <vector>

#include "DataTypes.h"
#include "messageheader.h"
#include <iostream>
class Message
{
public:


    Message()
        : payload_(), header_(), checksum_(0)
    {
        setAddresses(PartiesAddresses(PHYSICAL,0,0));
    }
    Message(const Message& source)
        :payload_(source.payload_), header_(source.header_), checksum_(source.checksum_)
    {
    }

    virtual ~Message(){}

//    virtual Data getRawMsgBytes();//chould add checksum automatically
    virtual Data getMsgBytes() const;//calculates and returns raw msg bytes but does not change internal fields

    virtual const Data &getPayload()const;
    virtual void setAddresses(PartiesAddresses addr);
    virtual void setPayload(const Data& payload);
    virtual void addHeader(bool isTwoByteHeadreSupported=false);
    char calculateChecksum();
private:
    char getChecksum() const;
    Data payload_;
    MessageHeader header_;
    char checksum_;

};

#endif // MESSAGE_H
